<?php
	$location = new Location();
	$location->select($location_id);
	$pictures = $location->getpictures();
	$pictures = json_decode($pictures, true);
	if ($pictures)
		foreach ($pictures as $key => $value)
			if ($value == $picture_id)
				unset($pictures[$key]);
	$pictures = json_encode($pictures);
	$location->setpictures($pictures);
	$location->update($location_id);
	
	// delete resize pictures
	$picture = new Picture();
	$picture->select($picture_id);
	$picture->deleteAllFiles();
	// delete picture object
	$picture->delete($picture_id);
	admin_load("Hình đã được xoá khỏi CSDL", "?act=pictures_location_list&location_id=".$location_id);
?>